package com.fly.auth.user

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.cloud.client.discovery.EnableDiscoveryClient

/**
 * @author  fly
 * @date  2021/5/19 15:35
 * @version 1.0
 */
@SpringBootApplication
@EnableDiscoveryClient
open class FlyAppUserApplication

fun main(args: Array<String>) {
    runApplication<FlyAppUserApplication>(*args)
}

/*
open class Init(
    private val databaseClient: DatabaseClient,
) : ApplicationRunner {

    private val logger: Logger = LoggerFactory.getLogger(ApplicationRunner::class.java)

    override fun run(args: ApplicationArguments?) {

        databaseClient.execute( """
        DROP TABLE IF EXISTS user;
        CREATE TABLE IF NOT EXISTS user (id SERIAL PRIMARY KEY, 
        name VARCHAR(100) NOT NULL, 
        password VARCHAR(100) NOT NULL,
        email VARCHAR(100) NOT NULL);   
        """.trimIndent())
            .then()
            .doOnSuccess { logger.info("Schema created") }
            .doOnError{logger.error("got error: {}", it.message) }
            .subscribe()
    }

}*/
